package com.middlegroup.subjectpay.service.impl;

import com.baomidou.mybatisplus.service.impl.ServiceImpl;
import com.middlegroup.subjectpay.entity.SubjectInBills;
import com.middlegroup.subjectpay.mapper.SubjectInBillsMapper;
import com.middlegroup.subjectpay.service.SubjectInBillsService;
import org.apache.commons.lang3.StringUtils;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;

/**
 * <p>
 * 主体端收款订单总表 服务实现类
 * </p>
 *
 * @author pc123
 * @since 2019-01-14
 */
@Service
public class SubjectInBillsServiceImpl extends ServiceImpl<SubjectInBillsMapper, SubjectInBills> implements SubjectInBillsService {
    @Resource
    SubjectInBillsMapper subjectInBillsMapper;

    @Override
    public SubjectInBills getLastOneInBills(SubjectInBills subjectInBills) {
        return subjectInBillsMapper.getLastOneInBills(subjectInBills);
    }

    @Override
    public SubjectInBills getLastOneInByBillNo(String billNo, String merchantBillNo) {
        SubjectInBills subjectInBills = new SubjectInBills();
        if (StringUtils.isNotBlank(billNo)) {
            subjectInBills.setBillNo(billNo);
        }
        if (StringUtils.isNotBlank(merchantBillNo)) {
            subjectInBills.setMerchantBillNo(merchantBillNo);
        }
        return subjectInBillsMapper.getLastOneInBills(subjectInBills);
    }

}
